//
//  sendChatText.m
//  tcpoctest
//
//  Created by gump on 5/23/13.
//  Copyright (c) 2013 gump. All rights reserved.
//

#import "sendChatText.h"
#import "taskDataSource.h"
#import "chatDataSource.h"

@implementation sendChatText

-(void)SendChatText:(NSString *)text withMail:(NSString *)mail
{
    if (![self CheckLogin]) {
        return;
    }
    
    const char *textchar = [text UTF8String];
    
    int l = CHAR_PL * 3 + [mail length] + strlen(textchar) + INT_PL * 2;
    
    [self initDataUseCurSequence:l];
    
    [sb WriteChar:[mail length]];
    [sb WriteString:mail withLength:[mail length]];
    [sb WriteInt:strlen(textchar) withNTT:NTT_SMALL2BIG];
    [sb WriteString:text withLength:strlen(textchar)];
    
    [self Package];
    
    [[DataControl shareControl].taskDS CompleteTaskByID:TI_F_CHAT
     withIsDirectShow:false];
}

@end
